# 比赛官方提供的重跑模型demo

import time
from openai import OpenAI


client = OpenAI(base_url='http://aigc.gdeia.com:31300/llm/v1', api_key='your_api_key')

success = False
resp = None

while not success:
    try:
        # 模型调用/嵌入/重拍
        resp = client.chat.completions.create(
            model="qwen3-8b",
            messages=[{"role": "user", "content": "你好"}],
            temperature=0.7,
            top_p=0.5,
            extra_body={"enable_thinking": False,'stream':False}
        )
        success = True  # 成功就跳出循环
    except Exception as e:
        print(f"调用失败: {e}，1秒后重试...")
        time.sleep(1)

print("结果是:", resp.choices[0].message.content)